{% extends "base.html" %}

{% block head %}
    <style>
        :root {
            --primary-color: #1976d2;
            --primary-hover: #1565c0;
            --border-color: #e0e0e0;
            --light-gray: #f5f5f5;
            --text-color: #333;
            --shadow-color: rgba(0, 0, 0, 0.1);
        }

        body {
            color: var(--text-color);
            background-color: #f8f9fa;
        }
        .ConfigureSearchParameters {

        }

        .ConfigureSearchParameters .cardHeaderDiv {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .cardHeaderDiv .card-header {
            background: var(--light-gray);
            border-radius: 8px 8px 0 0;
        }

        .card-header h2 {
            margin: 0;
            font-size: 1.5rem;
            color: #212332;
        }

        .card-header .card-header_text {
            font-size: 12px;
            font-weight: 400;
            color: #808080;
        }

        .cardHeaderDiv .card-header_baochun {
            width: 144px;
            height: 32px;
            border-radius: 3px;
            background: #000000;
            font-size: 20px;
            font-weight: 400;
            color: #FFFFFF;
            display: flex;
            align-items: center;
            justify-content: center;
            word-spacing: 24px;
            cursor: pointer;
        }

        .ConfigureSearchParameters .configurationParameter {
            margin-top: 10px;
        }

        .configurationParameter .configurationParameter_tit {
            font-size: 12px;
            font-weight: 400;
            letter-spacing: 0px;
            line-height: 14.06px;
            color: #212332;
        }

    </style>
    <style>
        .cardDiv {
            background: white;
            border-radius: 8px;
            box-shadow: 0 2px 4px var(--shadow-color);
            padding: 20px;
            margin-top: 10px;
            margin-bottom: 20px;
        }

        .result-table th,
        .result-table td {
            border: 1px solid #d9d9d9;
            padding: 6px 4px;
            text-align: left;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 150px;
        }

        .result-table th {
            background: #e6f7ff;
            color: #0050b3;
            font-weight: normal;
            position: sticky;
            top: 0;
            z-index: 1;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            min-width: 120px;
            padding: 8px 6px;
            line-height: 1.4;
        }

        .result-table tr:nth-child(even) {
            background: #f5faff;
        }

        .result-table td:hover {
            overflow: visible;
            white-space: normal;
            word-break: break-all;
            position: relative;
            z-index: 2;
            background: #fff;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }

        .pagination button {
            padding: 4px 12px;
            border: 1px solid #d9d9d9;
            border-radius: 4px;
            background: #fff;
            cursor: pointer;
        }

        .pagination button:disabled {
            background: #f5f5f5;
            cursor: not-allowed;
        }

        .pagination button.active {
            background: #1890ff;
            color: white;
            border-color: #1890ff;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
        }

        .checkbox-group {
            display: flex;
            flex-wrap: wrap;
            gap: 12px;
            padding: 10px;
            background-color: var(--light-gray);
            border-radius: 4px;
        }

        .checkbox-item {
            min-width: 120px;
            display: flex;
            align-items: center;
        }

        .radio-group {
            display: flex;
            gap: 24px;
            padding: 10px;
            background-color: var(--light-gray);
            border-radius: 4px;
        }

        .form-check {
            display: flex;
            align-items: center;
        }

        .form-check-input {
            margin-right: 6px;
        }

        .form-check-label {
            font-size: 14px;
            user-select: none;
        }

        .btn {
            display: inline-block;
            padding: 8px 16px;
            font-size: 14px;
            font-weight: 500;
            text-align: center;
            text-decoration: none;
            border-radius: 4px;
            cursor: pointer;
            transition: all 0.2s;
            border: 1px solid transparent;
        }

        .btn-outline-primary {
            background-color: transparent;
            border-color: var(--primary-color);
            color: var(--primary-color);
        }

        .btn-outline-primary:hover {
            background-color: var(--primary-color);
            color: white;
        }

        .btn-sm {
            padding: 4px 12px;
            font-size: 12px;
        }

        .select-all-btn {
            margin-bottom: 10px;
        }

        .field-checkbox input {
            margin-right: 8px;
        }

        .button-group > * {
            margin: 0 !important;
        }

        /* 字段选择按钮 */
        .field-select-btn {
            margin-left: 12px;
        }
    </style>
    <style>
        /* 超出率阈值输入框样式 */
        .threshold-input-group {
            display: flex;
            align-items: center;
            gap: 10px;
            background: white;
            border-radius: 8px;
        }

        .threshold-label {
            font-weight: 500;
            margin: 0;
            white-space: nowrap;
        }

        .threshold-input {
            flex: 1;
            padding: 8px 12px;
            border: 1px solid var(--border-color);
            border-radius: 4px;
            font-size: 14px;
        }

        .threshold-input-wide {
            flex: 1;
            padding: 8px 12px;
            border: 1px solid var(--border-color);
            border-radius: 4px;
            font-size: 14px;
        }

        .filter-item {
            display: inline-block;
            margin-right: 20px;
            margin-bottom: 10px;
        }

        .filter-checkbox {
            margin-right: 6px;
        }

        /* 保存成功提示样式 */
        .save-success-message {
            position: fixed;
            top: 20px;
            right: 20px;
            background-color: #4caf50;
            color: white;
            padding: 15px 20px;
            border-radius: 8px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            z-index: 1000;
            display: none;
            animation: slideInRight 0.3s ease-out;
        }

        .save-success-message.show {
            display: block;
        }

        @keyframes slideInRight {
            from {
                transform: translateX(100%);
                opacity: 0;
            }
            to {
                transform: translateX(0);
                opacity: 1;
            }
        }

        .save-success-message .message-content {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .save-success-message .check-icon {
            font-size: 18px;
            font-weight: bold;
        }
    </style>
{% endblock %}

{% block content %}
    <div class="ConfigureSearchParameters">
        <div class="cardHeaderDiv">
            <div class="card-header">
                <h2>配置检索参数</h2>
                <div class="card-header_text">参数配置</div>
            </div>
            <div class="card-header_baochun" onclick="saveConfiguration()">保 存</div>
        </div>

        <!-- 1.标准限额内虚开住宿费模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">1.标准限额内虚开住宿费模型</div>
            <div class="cardDiv">
                <form id="analysisForm">
                    <!-- 隐藏的文件夹路径输入 -->
                    <input type="hidden" id="folderPath" name="folderPath" required>

                    <!-- 年度选择 -->
                    <div class="form-group">
                        <label class="form-label">选择查询年度（可多选）：</label>
                        <button type="button" class="btn btn-outline-primary btn-sm select-all-btn" onclick="toggleSelectAll('years')">全选/取消全选</button>
                        <div class="checkbox-group" id="years">
                            <!-- 年度选项将通过JavaScript动态生成 -->
                        </div>
                    </div>

                    <!-- 级别选择 -->
                    <div class="form-group">
                        <label class="form-label">级别（可多选）：</label>
                        <button type="button" class="btn btn-outline-primary btn-sm select-all-btn" onclick="toggleSelectAll('month_year_1')">全选/取消全选</button>
                        <div class="checkbox-group" id="month_year_1">
                            <div class="checkbox-item">
                                <input type="checkbox" class="form-check-input" id="month_1" name="month_year_1" value="月度">
                                <label class="form-check-label" for="month_1">月度</label>
                            </div>
                            <div class="checkbox-item">
                                <input type="checkbox" class="form-check-input" id="year_1" name="month_year_1" value="年度">
                                <label class="form-check-label" for="year_1">年度</label>
                            </div>
                        </div>
                    </div>

                    <!-- 维度选择（多选） -->
                    <div class="form-group">
                        <label class="form-label">查询维度（可多选）：</label>
                        <button type="button" class="btn btn-outline-primary btn-sm select-all-btn" onclick="toggleSelectAll('dimension')">全选/取消全选</button>
                        <div class="checkbox-group" id="dimension">
                            <div class="checkbox-item">
                                <input type="checkbox" class="form-check-input" id="dimension_city" name="dimension" value="同城市">
                                <label class="form-check-label" for="dimension_city">同城市</label>
                            </div>
                            <div class="checkbox-item">
                                <input type="checkbox" class="form-check-input" id="dimension_hotel" name="dimension" value="同一酒店">
                                <label class="form-check-label" for="dimension_hotel">同一酒店</label>
                            </div>
                        </div>
                    </div>

                    <!-- 档位选择 -->
                    <div class="form-group">
                        <label class="form-label">档位选择（可多选）：</label>
                        <button type="button" class="btn btn-outline-primary btn-sm select-all-btn" onclick="toggleSelectAll('levels')">全选/取消全选</button>
                        <div class="checkbox-group" id="levels">
                            <div class="checkbox-item">
                                <input type="checkbox" class="form-check-input" id="level1" name="levels" value="一档0-20%">
                                <label class="form-check-label" for="level1">一档0-20%</label>
                            </div>
                            <div class="checkbox-item">
                                <input type="checkbox" class="form-check-input" id="level2" name="levels" value="二档20-40%">
                                <label class="form-check-label" for="level2">二档20-40%</label>
                            </div>
                            <div class="checkbox-item">
                                <input type="checkbox" class="form-check-input" id="level3" name="levels" value="三档40-60%">
                                <label class="form-check-label" for="level3">三档40-60%</label>
                            </div>
                            <div class="checkbox-item">
                                <input type="checkbox" class="form-check-input" id="level4" name="levels" value="四档60-80%">
                                <label class="form-check-label" for="level4">四档60-80%</label>
                            </div>
                            <div class="checkbox-item">
                                <input type="checkbox" class="form-check-input" id="level5" name="levels" value="五档80-100%">
                                <label class="form-check-label" for="level5">五档80-100%</label>
                            </div>
                            <div class="checkbox-item">
                                <input type="checkbox" class="form-check-input" id="level6" name="levels" value="六档≥100%">
                                <label class="form-check-label" for="level6">六档≥100%</label>
                            </div>
                        </div>
                    </div>

                    <!-- 提交按钮 -->
                    <!-- <div class="form-group">
                        <div class="button-group">
                            <button type="submit" class="btn btn-primary">立即输出</button>
                            <button type="button" class="btn btn-outline-primary field-select-btn" onclick="openFieldSelection()" style="display: none;">选择字段</button>
                            <a href="/download-travel-excel" class="btn btn-outline-primary download-btn" id="downloadBtn" style="display: none;">下载Excel</a>
                        </div>
                    </div> -->
                </form>
            </div>
        </div>
        <!-- 1.标准限额内虚开住宿费模型 - Page - 结束 -->
        <!-- 2.住宿天数为偶数但住宿费为奇数模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">2.住宿天数为偶数但住宿费为奇数模型</div>
            <div class="cardDiv">
                <form id="analysisForm">
                    <!-- 隐藏的文件夹路径输入 -->
                    <input type="hidden" id="folderPath" name="folderPath" required>

                    <!-- 年度选择 -->
                    <div class="form-group">
                        <label class="form-label">选择查询年度（可多选）：</label>
                        <button type="button" class="btn btn-outline-primary btn-sm select-all-btn" onclick="toggleSelectAll('years_2')">全选/取消全选</button>
                        <div class="checkbox-group" id="years_2">
                            <!-- 年度选项将通过JavaScript动态生成 -->
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <!-- 2.住宿天数为偶数但住宿费为奇数模型 - Page - 结束 -->
        <!-- 3.超标准全额报销高铁动车费模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">3.超标准全额报销高铁动车费模型</div>
            <div class="cardDiv">
                <!-- 超出率阈值输入框 -->
                <div class="threshold-input-group">
                    <label for="thresholdInput3" class="threshold-label">超出率阈值（%）：</label>
                    <input type="number" id="thresholdInput3" class="threshold-input" min="0" step="0.01" placeholder="例如：20">
                </div>
            </div>
        </div>
        <!-- 3.超标准全额报销高铁动车费模型 - Page - 结束 -->
        <!-- 4.超标准乘坐交通工具模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">4.超标准乘坐交通工具模型</div>
            <div class="cardDiv">
                <!-- 超出率阈值输入框 -->
                <div class="threshold-input-group">
                    <label for="thresholdInput4" class="threshold-label">超出率阈值（%）：</label>
                    <input type="number" id="thresholdInput4" class="threshold-input" min="0" step="0.01" placeholder="例如：20">
                </div>
            </div>
        </div>
        <!-- 4.超标准乘坐交通工具模型 - Page - 结束 -->
        <!-- 5.乘坐飞机经济舱审批是否合规模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">5.乘坐飞机经济舱审批是否合规模型</div>
        </div>
        <!-- 5.乘坐飞机经济舱审批是否合规模型 - Page - 结束 -->
        <!-- 6.报销在途期间外交通补助模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">6.报销在途期间外交通补助模型</div>
            <div class="cardDiv">
                <!-- 筛选输入框 -->
                <div class="threshold-input-group">
                    <label for="thresholdInput6-1" class="threshold-label">筛选：</label>
                    <input type="text" id="thresholdInput6-1" class="threshold-input-wide" placeholder="例如：出差 培训">
                </div>
                <!-- 过滤输入框 -->
                <div class="threshold-input-group">
                    <label for="thresholdInput6-2" class="threshold-label">过滤：</label>
                    <input type="text" id="thresholdInput6-2" class="threshold-input-wide" placeholder="例如：出差 培训">
                </div>
            </div>
        </div>
        <!-- 6.报销在途期间外交通补助模型 - Page - 结束 -->
        <!-- 7.自带车出差却报销交通补助模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">7.自带车出差却报销交通补助模型</div>
            <div class="cardDiv">
                <div class="filter-item">
                    <input type="checkbox" id="levelOne7" class="filter-checkbox" checked>
                    <label for="levelOne7">一级优先级</label>
                </div>
                <div class="filter-item">
                    <input type="checkbox" id="levelTwo7" class="filter-checkbox" checked>
                    <label for="levelTwo7">二级优先级</label>
                </div>
            </div>
        </div>
        <!-- 7.自带车出差却报销交通补助模型 - Page - 结束 -->
        <!-- 8.超天数报销交通补助模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">8.超天数报销交通补助模型</div>
            <div class="cardDiv">
                <div class="filter-item">
                    <input type="checkbox" id="levelOne8" class="filter-checkbox" checked>
                    <label for="levelOne8">一级优先级</label>
                </div>
                <div class="filter-item">
                    <input type="checkbox" id="levelTwo8" class="filter-checkbox" checked>
                    <label for="levelTwo8">二级优先级</label>
                </div>
            </div>
        </div>
        <!-- 8.超天数报销交通补助模型 - Page - 结束 -->
        <!-- 9.超标准报销住宿费模型 - Page -->
         <div class="configurationParameter">
            <div class="configurationParameter_tit">9.超标准报销住宿费模型</div>
        </div>
        <!-- 9.超标准报销住宿费模型 - Page - 结束 -->
        <!-- 10.出差日期重叠重复报销模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">10.出差日期重叠重复报销模型</div>
        </div>
        <!-- 10.出差日期重叠重复报销模型 - Page - 结束 -->
        <!-- 11.节假日出差模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">11.节假日出差模型</div>
            <div class="cardDiv">
                <div class="filter-item">
                    <input type="checkbox" id="levelOne11" class="filter-checkbox" checked>
                    <label for="levelOne11">一级城市</label>
                </div>
                <div class="filter-item">
                    <input type="checkbox" id="levelTwo11" class="filter-checkbox" checked>
                    <label for="levelTwo11">二级城市</label>
                </div>
                <div class="filter-item">
                    <input type="checkbox" id="levelThree11" class="filter-checkbox" checked>
                    <label for="levelThree11">三级城市</label>
                </div>
            </div>
        </div>
        <!-- 11.节假日出差模型 - Page - 结束 -->
         <!-- 12.出差变更目的地不合理模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">12.出差变更目的地不合理模型</div>
            <div class="cardDiv">
                <div class="filter-item">
                    <input type="checkbox" id="levelOne12" class="filter-checkbox" checked>
                    <label for="levelOne12">一级</label>
                </div>
                <div class="filter-item">
                    <input type="checkbox" id="levelTwo12" class="filter-checkbox" checked>
                    <label for="levelTwo12">二级</label>
                </div>
            </div>
        </div>
        <!-- 12.出差变更目的地不合理模型 - Page - 结束 -->
        <!-- 13.超标准报销伙食补助模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">13.超标准报销伙食补助模型</div>
        </div>
        <!-- 13.超标准报销伙食补助模型 - Page - 结束 -->
        <!-- 14.超天数伙食交通补助模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">14.超天数伙食交通补助模型</div>
            <div class="cardDiv">
                <div class="filter-item">
                    <input type="checkbox" id="levelOne14" class="filter-checkbox" checked>
                    <label for="levelOne14">一级优先级</label>
                </div>
                <div class="filter-item">
                    <input type="checkbox" id="levelTwo14" class="filter-checkbox" checked>
                    <label for="levelTwo14">二级优先级</label>
                </div>
            </div>
        </div>
        <!-- 14.超天数伙食交通补助模型 - Page - 结束 -->
        <!-- 15.一张发票多次报销模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">15.一张发票多次报销模型</div>
        </div>
        <!-- 15.一张发票多次报销模型 - Page - 结束 -->
        <!-- 16.节假日、周末发生招待模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">16.节假日、周末发生招待模型</div>
            <div class="cardDiv">
                <div class="filter-item">
                    <input type="checkbox" id="levelOne16" class="filter-checkbox" checked>
                    <label for="levelOne16">按开票日期筛选</label>
                </div>
                <div class="filter-item">
                    <input type="checkbox" id="levelTwo16" class="filter-checkbox" checked>
                    <label for="levelTwo16">按实际发生日期筛选</label>
                </div>
            </div>
        </div>
        <!-- 16.节假日、周末发生招待模型 - Page - 结束 -->
        <!-- 17.虚开业务招待发票模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">17.虚开业务招待发票模型</div>
            <div class="cardDiv">
                <div class="form-group">
                    <label>销方单位等级：</label>
                    <div class="filter-item">
                        <input type="checkbox" id="sellerLevelOne17" name="sellerLevel17" value="一级销方单位" class="filter-checkbox" checked>
                        <label for="sellerLevelOne17">一级销方单位</label>
                    </div>
                    <div class="filter-item">
                        <input type="checkbox" id="sellerLevelTwo17" name="sellerLevel17" value="二级销方单位" class="filter-checkbox" checked>
                        <label for="sellerLevelTwo17">二级销方单位</label>
                    </div>
                </div>
                <div class="form-group">
                    <label>发票金额等级：</label>
                    <div class="filter-item">
                        <input type="checkbox" id="invoiceLevelOne17" name="invoiceLevel17" value="发票一级" class="filter-checkbox" checked>
                        <label for="invoiceLevelOne17">发票一级</label>
                    </div>
                    <div class="filter-item">
                        <input type="checkbox" id="invoiceLevelTwo17" name="invoiceLevel17" value="发票二级" class="filter-checkbox" checked>
                        <label for="invoiceLevelTwo17">发票二级</label>
                    </div>
                </div>
            </div>
        </div>
        <!-- 17.虚开业务招待发票模型 - Page - 结束 -->
        <!-- 18.单一销方单位连号模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">18.单一销方单位连号模型</div>
            <div class="cardDiv">
                <div class="form-group">
                    <label>风险等级：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
                    <div class="filter-item">
                        <input type="checkbox" id="riskLevelOne18" name="riskLevel18" class="filter-checkbox" checked>
                        <label for="riskLevelOne18">一级风险</label>
                    </div>
                    <div class="filter-item">
                        <input type="checkbox" id="riskLevelTwo18" name="riskLevel18" class="filter-checkbox" checked>
                        <label for="riskLevelTwo18">二级风险</label>
                    </div>
                </div>
                <div class="form-group">
                    <label>发票金额等级：</label>
                    <div class="filter-item">
                        <input type="checkbox" id="invoiceLevelOne18" name="invoiceLevel18" class="filter-checkbox" checked>
                        <label for="invoiceLevelOne18">发票一级</label>
                    </div>
                    <div class="filter-item">
                        <input type="checkbox" id="invoiceLevelTwo18" name="invoiceLevel18" class="filter-checkbox" checked>
                        <label for="invoiceLevelTwo18">发票二级</label>
                    </div>
                </div>
            </div>
        </div>
        <!-- 18.单一销方单位连号模型 - Page - 结束 -->
        <!-- 19.公司管辖范围外发生业务招待费模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">19.公司管辖范围外发生业务招待费模型</div>
            <div class="cardDiv">
                <div class="form-group">
                    <label>风险等级：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
                    <div class="filter-item">
                        <input type="checkbox" id="riskLevelOne19" name="riskLevel19" class="filter-checkbox" checked>
                        <label for="riskLevelOne19">一级风险</label>
                    </div>
                    <div class="filter-item">
                        <input type="checkbox" id="riskLevelTwo19" name="riskLevel19" class="filter-checkbox" checked>
                        <label for="riskLevelTwo19">二级风险</label>
                    </div>
                </div>
                <div class="form-group">
                    <label>地址匹配状态：</label>
                    <div class="filter-item">
                        <input type="checkbox" id="addressMatchOne19" name="addressMatch19" class="filter-checkbox" checked>
                        <label for="addressMatchOne19">不匹配</label>
                    </div>
                    <div class="filter-item">
                        <input type="checkbox" id="addressMatchTwo19" name="addressMatch19" class="filter-checkbox" checked>
                        <label for="addressMatchTwo19">税号地址未知</label>
                    </div>
                    <div class="filter-item">
                        <input type="checkbox" id="addressMatchThree19" name="addressMatch19" class="filter-checkbox" checked>
                        <label for="addressMatchThree19">组织所在地未知</label>
                    </div>
                </div>
            </div>
        </div>
        <!-- 19.公司管辖范围外发生业务招待费模型 - Page - 结束 -->
        <!-- 20.主办会议人数超标模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">20.主办会议人数超标模型</div>
        </div>
        <!-- 20.主办会议人数超标模型 - Page - 结束 -->
        <!-- 21.主办会议天数超标模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">21.主办会议天数超标模型</div>
        </div>
        <!-- 21.主办会议天数超标模型 - Page - 结束 -->
        <!-- 22.主办会议金额超标模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">22.主办会议金额超标模型</div>
        </div>
        <!-- 22.主办会议金额超标模型 - Page - 结束 -->
        <!-- 23.外出会议未请假模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">23.外出会议未请假模型</div>
        </div>
        <!-- 23.外出会议未请假模型 - Page - 结束 -->
        <!-- 24.报销在途期间外交通补助模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">24.报销在途期间外交通补助模型</div>
            <div class="cardDiv">
                <!-- 筛选输入框 -->
                <div class="threshold-input-group">
                    <label for="thresholdInput24-1" class="threshold-label">筛选：</label>
                    <input type="text" id="thresholdInput24-1" class="threshold-input-wide" placeholder="例如：出差 培训">
                </div>
                <!-- 过滤输入框 -->
                <div class="threshold-input-group">
                    <label for="thresholdInput24-2" class="threshold-label">过滤：</label>
                    <input type="text" id="thresholdInput24-2" class="threshold-input-wide" placeholder="例如：出差 培训">
                </div>
            </div>
        </div>
        <!-- 24.报销在途期间外交通补助模型 - Page - 结束 -->
        <!-- 25.自带车出差却报销交通补助模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">25.自带车出差却报销交通补助模型</div>
            <div class="cardDiv">
                <div class="filter-item">
                    <input type="checkbox" id="levelOne25" class="filter-checkbox" checked>
                    <label for="levelOne25">一级优先级</label>
                </div>
                <div class="filter-item">
                    <input type="checkbox" id="levelTwo25" class="filter-checkbox" checked>
                    <label for="levelTwo25">二级优先级</label>
                </div>
            </div>
        </div>
        <!-- 25.自带车出差却报销交通补助模型 - Page - 结束 -->
        <!-- 26.超天数报销交通补助模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">26.超天数报销交通补助模型</div>
            <div class="cardDiv">
                <div class="filter-item">
                    <input type="checkbox" id="levelOne26" class="filter-checkbox" checked>
                    <label for="levelOne26">一级优先级</label>
                </div>
                <div class="filter-item">
                    <input type="checkbox" id="levelTwo26" class="filter-checkbox" checked>
                    <label for="levelTwo26">二级优先级</label>
                </div>
            </div>
        </div>
        <!-- 26.超天数报销交通补助模型 - Page - 结束 -->
        <!-- 27.超标准报销住宿费模型 - Page -->
         <div class="configurationParameter">
            <div class="configurationParameter_tit">27.超标准报销住宿费模型</div>
        </div>
        <!-- 27.超标准报销住宿费模型 - Page - 结束 -->
        <!-- 28.出差日期重叠重复报销模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">28.出差日期重叠重复报销模型</div>
        </div>
        <!-- 28.出差日期重叠重复报销模型 - Page - 结束 -->
        <!-- 29.外出培训未请假模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">29.外出培训未请假模型</div>
        </div>
        <!-- 29.外出培训未请假模型 - Page - 结束 -->
        <!-- 30.超天数伙食交通补助模型 - Page -->
        <div class="configurationParameter">
            <div class="configurationParameter_tit">30.超天数伙食交通补助模型</div>
            <div class="cardDiv">
                <div class="filter-item">
                    <input type="checkbox" id="levelOne30" class="filter-checkbox" checked>
                    <label for="levelOne30">一级优先级</label>
                </div>
                <div class="filter-item">
                    <input type="checkbox" id="levelTwo30" class="filter-checkbox" checked>
                    <label for="levelTwo30">二级优先级</label>
                </div>
            </div>
        </div>
        <!-- 30.超天数伙食交通补助模型 - Page - 结束 -->
    </div>

    <!-- 保存成功提示 -->
    <div id="saveSuccessMessage" class="save-success-message">
        <div class="message-content">
            <span class="check-icon">✓</span>
            <span>配置参数保存成功！</span>
        </div>
    </div>

    <script>
        /* 1.标准限额内虚开住宿费模型 - JS */
            // 生成年度选项（当前年份往前10年）
            const yearsDiv = document.getElementById('years');
            const currentYear = new Date().getFullYear();
            for (let year = currentYear; year >= currentYear - 10; year--) {
                const div = document.createElement('div');
                div.className = 'checkbox-item';
                div.innerHTML = `
                    <input type="checkbox" class="form-check-input" id="year_${year}" name="years" value="${year}">
                    <label class="form-check-label" for="year_${year}">${year}</label>
                `;
                yearsDiv.appendChild(div);
            }

            // 全选/取消全选功能
            function toggleSelectAll(groupId) {
                const container = document.getElementById(groupId);
                const checkboxes = container.querySelectorAll('input[type="checkbox"]');
                const allChecked = Array.from(checkboxes).every(cb => cb.checked);

                checkboxes.forEach(checkbox => {
                    checkbox.checked = !allChecked;
                });
            }
        /* 1.标准限额内虚开住宿费模型 - JS - 结束 */
        /* 2.住宿天数为偶数但住宿费为奇数模型 - JS */
            // 生成年度选项（当前年份往前10年）
            const yearsDiv_2 = document.getElementById('years_2');
            const currentYear_2 = new Date().getFullYear();
            for (let year = currentYear_2; year >= currentYear_2 - 10; year--) {
                const div_2 = document.createElement('div');
                div_2.className = 'checkbox-item';
                div_2.innerHTML = `
                    <input type="checkbox" class="form-check-input" id="year_${year}" name="years" value="${year}">
                    <label class="form-check-label" for="year_${year}">${year}</label>
                `;
                yearsDiv_2.appendChild(div_2);
            }

            // 全选/取消全选功能
            function toggleSelectAll(groupId) {
                const container = document.getElementById(groupId);
                const checkboxes = container.querySelectorAll('input[type="checkbox"]');
                const allChecked = Array.from(checkboxes).every(cb => cb.checked);

                checkboxes.forEach(checkbox => {
                    checkbox.checked = !allChecked;
                });
            }
        /* 2.住宿天数为偶数但住宿费为奇数模型 - JS - 结束 */

        // 保存配置参数到localStorage
        function saveConfiguration() {
            const config = {};

            // 1. 标准限额内虚开住宿费模型
            config.model1 = {
                years: getSelectedValues('years'),
                month_year: getSelectedValues('month_year_1'),
                dimension: getSelectedValues('dimension'),
                levels: getSelectedValues('levels')
            };

            // 2. 住宿天数为偶数但住宿费为奇数模型
            config.model2 = {
                years: getSelectedValues('years_2')
            };

            // 3. 超标准全额报销高铁动车费模型
            config.model3 = {
                threshold: document.getElementById('thresholdInput3') ? document.getElementById('thresholdInput3').value : ''
            };

            // 4. 超标准乘坐交通工具模型
            config.model4 = {
                threshold: document.getElementById('thresholdInput4') ? document.getElementById('thresholdInput4').value : ''
            };

            // 6. 报销在途期间外交通补助模型
            config.model6 = {
                filter: document.getElementById('thresholdInput6-1') ? document.getElementById('thresholdInput6-1').value : '',
                filter2: document.getElementById('thresholdInput6-2') ? document.getElementById('thresholdInput6-2').value : ''
            };

            // 7. 自带车出差却报销交通补助模型
            config.model7 = {
                levelOne: document.getElementById('levelOne7') ? document.getElementById('levelOne7').checked : true,
                levelTwo: document.getElementById('levelTwo7') ? document.getElementById('levelTwo7').checked : true
            };

            // 8. 超天数报销交通补助模型
            config.model8 = {
                levelOne: document.getElementById('levelOne8') ? document.getElementById('levelOne8').checked : true,
                levelTwo: document.getElementById('levelTwo8') ? document.getElementById('levelTwo8').checked : true
            };

            // 11. 节假日出差模型
            config.model11 = {
                levelOne: document.getElementById('levelOne11') ? document.getElementById('levelOne11').checked : true,
                levelTwo: document.getElementById('levelTwo11') ? document.getElementById('levelTwo11').checked : true,
                levelThree: document.getElementById('levelThree11') ? document.getElementById('levelThree11').checked : true
            };

            // 12. 出差变更目的地不合理模型
            config.model12 = {
                levelOne: document.getElementById('levelOne12') ? document.getElementById('levelOne12').checked : true,
                levelTwo: document.getElementById('levelTwo12') ? document.getElementById('levelTwo12').checked : true
            };

            // 14. 超天数伙食交通补助模型
            config.model14 = {
                levelOne: document.getElementById('levelOne14') ? document.getElementById('levelOne14').checked : true,
                levelTwo: document.getElementById('levelTwo14') ? document.getElementById('levelTwo14').checked : true
            };

            // 16. 节假日、周末发生招待模型
            config.model16 = {
                levelOne: document.getElementById('levelOne16') ? document.getElementById('levelOne16').checked : true,
                levelTwo: document.getElementById('levelTwo16') ? document.getElementById('levelTwo16').checked : true
            };

            // 17. 虚开业务招待发票模型
            config.model17 = {
                sellerLevelOne: document.getElementById('sellerLevelOne17') ? document.getElementById('sellerLevelOne17').checked : true,
                sellerLevelTwo: document.getElementById('sellerLevelTwo17') ? document.getElementById('sellerLevelTwo17').checked : true,
                invoiceLevelOne: document.getElementById('invoiceLevelOne17') ? document.getElementById('invoiceLevelOne17').checked : true,
                invoiceLevelTwo: document.getElementById('invoiceLevelTwo17') ? document.getElementById('invoiceLevelTwo17').checked : true
            };

            // 18. 单一销方单位连号模型
            config.model18 = {
                levelOne: document.getElementById('riskLevelOne18') ? document.getElementById('riskLevelOne18').checked : true,
                levelTwo: document.getElementById('riskLevelTwo18') ? document.getElementById('riskLevelTwo18').checked : true,
                invoiceLevelOne: document.getElementById('invoiceLevelOne18') ? document.getElementById('invoiceLevelOne18').checked : true,
                invoiceLevelTwo: document.getElementById('invoiceLevelTwo18') ? document.getElementById('invoiceLevelTwo18').checked : true
            };

            // 19. 公司管辖范围外发生业务招待费模型
            config.model19 = {
                riskLevelOne: document.getElementById('riskLevelOne19') ? document.getElementById('riskLevelOne19').checked : true,
                riskLevelTwo: document.getElementById('riskLevelTwo19') ? document.getElementById('riskLevelTwo19').checked : true,
                addressMatchOne: document.getElementById('addressMatchOne19') ? document.getElementById('addressMatchOne19').checked : true,
                addressMatchTwo: document.getElementById('addressMatchTwo19') ? document.getElementById('addressMatchTwo19').checked : true,
                addressMatchThree: document.getElementById('addressMatchThree19') ? document.getElementById('addressMatchThree19').checked : true
            };

            // 24. 报销在途期间外交通补助模型
            config.model24 = {
                filter: document.getElementById('thresholdInput24-1') ? document.getElementById('thresholdInput24-1').value : '',
                filter2: document.getElementById('thresholdInput24-2') ? document.getElementById('thresholdInput24-2').value : ''
            };

            // 25. 自带车出差却报销交通补助模型
            config.model25 = {
                levelOne: document.getElementById('levelOne25') ? document.getElementById('levelOne25').checked : true,
                levelTwo: document.getElementById('levelTwo25') ? document.getElementById('levelTwo25').checked : true
            };

            // 26. 超天数报销交通补助模型
            config.model26 = {
                levelOne: document.getElementById('levelOne26') ? document.getElementById('levelOne26').checked : true,
                levelTwo: document.getElementById('levelTwo26') ? document.getElementById('levelTwo26').checked : true
            };

            // 27. 超标准报销住宿费模型
            config.model27 = {
                // No specific fields to save for this model
            };

            // 28. 出差日期重叠重复报销模型
            config.model28 = {
                // No specific fields to save for this model
            };

            // 29. 外出培训未请假模型
            config.model29 = {
                // No specific fields to save for this model
            };

            // 30. 超天数伙食交通补助模型
            config.model30 = {
                levelOne: document.getElementById('levelOne30') ? document.getElementById('levelOne30').checked : true,
                levelTwo: document.getElementById('levelTwo30') ? document.getElementById('levelTwo30').checked : true
            };

            // 保存到localStorage
            localStorage.setItem('modelConfigurations', JSON.stringify(config));
            
            // 显示保存成功提示
            showSaveSuccessMessage();
        }

        // 获取选中的复选框值
        function getSelectedValues(containerId) {
            const container = document.getElementById(containerId);
            if (!container) return [];
            
            const checkboxes = container.querySelectorAll('input[type="checkbox"]:checked');
            return Array.from(checkboxes).map(cb => cb.value);
        }

        // 获取选中的单选按钮值
        function getSelectedRadioValue(name) {
            const radio = document.querySelector(`input[name="${name}"]:checked`);
            return radio ? radio.value : '';
        }

        // 获取指定name的checkbox选中值
        function getSelectedCheckboxValues(name) {
            const checkboxes = document.querySelectorAll(`input[name="${name}"]:checked`);
            return Array.from(checkboxes).map(cb => cb.value);
        }

        // 页面加载时恢复配置
        window.addEventListener('DOMContentLoaded', function() {
            const savedConfig = localStorage.getItem('modelConfigurations');
            if (savedConfig) {
                const config = JSON.parse(savedConfig);
                restoreConfiguration(config);
            }
        });

        // 恢复配置参数
        function restoreConfiguration(config) {
            // 恢复模型1的配置
            if (config.model1) {
                restoreCheckboxes('years', config.model1.years);
                restoreCheckboxes('month_year_1', config.model1.month_year);
                restoreCheckboxes('dimension', config.model1.dimension);
                restoreCheckboxes('levels', config.model1.levels);
            }

            // 恢复模型2的配置
            if (config.model2) {
                restoreCheckboxes('years_2', config.model2.years);
            }

            // 恢复模型3的配置
            if (config.model3 && config.model3.threshold) {
                const thresholdInput = document.getElementById('thresholdInput3');
                if (thresholdInput) {
                    thresholdInput.value = config.model3.threshold;
                }
            }

            // 恢复模型4的配置
            if (config.model4 && config.model4.threshold) {
                const thresholdInput = document.getElementById('thresholdInput4');
                if (thresholdInput) {
                    thresholdInput.value = config.model4.threshold;
                }
            }

            // 恢复模型6的配置
            if (config.model6) {
                if (config.model6.filter) {
                    const filterInput = document.getElementById('thresholdInput6-1');
                    if (filterInput) {
                        filterInput.value = config.model6.filter;
                    }
                }
                if (config.model6.filter2) {
                    const filter2Input = document.getElementById('thresholdInput6-2');
                    if (filter2Input) {
                        filter2Input.value = config.model6.filter2;
                    }
                }
            }

            // 恢复模型7的配置
            if (config.model7) {
                if (document.getElementById('levelOne7')) {
                    document.getElementById('levelOne7').checked = config.model7.levelOne;
                }
                if (document.getElementById('levelTwo7')) {
                    document.getElementById('levelTwo7').checked = config.model7.levelTwo;
                }
            }

            // 恢复模型8的配置
            if (config.model8) {
                if (document.getElementById('levelOne8')) {
                    document.getElementById('levelOne8').checked = config.model8.levelOne;
                }
                if (document.getElementById('levelTwo8')) {
                    document.getElementById('levelTwo8').checked = config.model8.levelTwo;
                }
            }

            // 恢复模型11的配置
            if (config.model11) {
                if (document.getElementById('levelOne11')) {
                    document.getElementById('levelOne11').checked = config.model11.levelOne;
                }
                if (document.getElementById('levelTwo11')) {
                    document.getElementById('levelTwo11').checked = config.model11.levelTwo;
                }
                if (document.getElementById('levelThree11')) {
                    document.getElementById('levelThree11').checked = config.model11.levelThree;
                }
            }

            // 恢复模型12的配置
            if (config.model12) {
                if (document.getElementById('levelOne12')) {
                    document.getElementById('levelOne12').checked = config.model12.levelOne;
                }
                if (document.getElementById('levelTwo12')) {
                    document.getElementById('levelTwo12').checked = config.model12.levelTwo;
                }
            }

            // 恢复模型14的配置
            if (config.model14) {
                if (document.getElementById('levelOne14')) {
                    document.getElementById('levelOne14').checked = config.model14.levelOne;
                }
                if (document.getElementById('levelTwo14')) {
                    document.getElementById('levelTwo14').checked = config.model14.levelTwo;
                }
            }

            // 恢复模型16的配置
            if (config.model16) {
                if (document.getElementById('levelOne16')) {
                    document.getElementById('levelOne16').checked = config.model16.levelOne;
                }
                if (document.getElementById('levelTwo16')) {
                    document.getElementById('levelTwo16').checked = config.model16.levelTwo;
                }
            }

            // 恢复模型17的配置
            if (config.model17) {
                if (document.getElementById('sellerLevelOne17')) {
                    document.getElementById('sellerLevelOne17').checked = config.model17.sellerLevelOne;
                }
                if (document.getElementById('sellerLevelTwo17')) {
                    document.getElementById('sellerLevelTwo17').checked = config.model17.sellerLevelTwo;
                }
                if (document.getElementById('invoiceLevelOne17')) {
                    document.getElementById('invoiceLevelOne17').checked = config.model17.invoiceLevelOne;
                }
                if (document.getElementById('invoiceLevelTwo17')) {
                    document.getElementById('invoiceLevelTwo17').checked = config.model17.invoiceLevelTwo;
                }
            }

            // 恢复模型18的配置
            if (config.model18) {
                if (document.getElementById('riskLevelOne18')) {
                    document.getElementById('riskLevelOne18').checked = config.model18.levelOne;
                }
                if (document.getElementById('riskLevelTwo18')) {
                    document.getElementById('riskLevelTwo18').checked = config.model18.levelTwo;
                }
                if (document.getElementById('invoiceLevelOne18')) {
                    document.getElementById('invoiceLevelOne18').checked = config.model18.invoiceLevelOne;
                }
                if (document.getElementById('invoiceLevelTwo18')) {
                    document.getElementById('invoiceLevelTwo18').checked = config.model18.invoiceLevelTwo;
                }
            }

            // 恢复模型19的配置
            if (config.model19) {
                if (document.getElementById('riskLevelOne19')) {
                    document.getElementById('riskLevelOne19').checked = config.model19.riskLevelOne;
                }
                if (document.getElementById('riskLevelTwo19')) {
                    document.getElementById('riskLevelTwo19').checked = config.model19.riskLevelTwo;
                }
                if (document.getElementById('addressMatchOne19')) {
                    document.getElementById('addressMatchOne19').checked = config.model19.addressMatchOne;
                }
                if (document.getElementById('addressMatchTwo19')) {
                    document.getElementById('addressMatchTwo19').checked = config.model19.addressMatchTwo;
                }
                if (document.getElementById('addressMatchThree19')) {
                    document.getElementById('addressMatchThree19').checked = config.model19.addressMatchThree;
                }
            }

            // 恢复模型24的配置
            if (config.model24) {
                if (config.model24.filter) {
                    const filterInput = document.getElementById('thresholdInput24-1');
                    if (filterInput) {
                        filterInput.value = config.model24.filter;
                    }
                }
                if (config.model24.filter2) {
                    const filter2Input = document.getElementById('thresholdInput24-2');
                    if (filter2Input) {
                        filter2Input.value = config.model24.filter2;
                    }
                }
            }

            // 恢复模型25的配置
            if (config.model25) {
                if (document.getElementById('levelOne25')) {
                    document.getElementById('levelOne25').checked = config.model25.levelOne;
                }
                if (document.getElementById('levelTwo25')) {
                    document.getElementById('levelTwo25').checked = config.model25.levelTwo;
                }
            }

            // 恢复模型26的配置
            if (config.model26) {
                if (document.getElementById('levelOne26')) {
                    document.getElementById('levelOne26').checked = config.model26.levelOne;
                }
                if (document.getElementById('levelTwo26')) {
                    document.getElementById('levelTwo26').checked = config.model26.levelTwo;
                }
            }

            // 恢复模型27的配置
            if (config.model27) {
                // No specific fields to restore for this model
            }

            // 恢复模型28的配置
            if (config.model28) {
                // No specific fields to restore for this model
            }

            // 恢复模型29的配置
            if (config.model29) {
                // No specific fields to restore for this model
            }

            // 恢复模型30的配置
            if (config.model30) {
                if (document.getElementById('levelOne30')) {
                    document.getElementById('levelOne30').checked = config.model30.levelOne;
                }
                if (document.getElementById('levelTwo30')) {
                    document.getElementById('levelTwo30').checked = config.model30.levelTwo;
                }
            }
        }

        // 恢复复选框状态
        function restoreCheckboxes(containerId, values) {
            const container = document.getElementById(containerId);
            if (!container) return;
            
            const checkboxes = container.querySelectorAll('input[type="checkbox"]');
            checkboxes.forEach(cb => {
                cb.checked = values.includes(cb.value);
            });
        }

        // 恢复单选按钮状态
        function restoreRadio(name, value) {
            const radio = document.querySelector(`input[name="${name}"][value="${value}"]`);
            if (radio) {
                radio.checked = true;
            }
        }

        // 显示保存成功提示
        function showSaveSuccessMessage() {
            const message = document.getElementById('saveSuccessMessage');
            message.classList.add('show');
            
            // 3秒后自动隐藏
            setTimeout(() => {
                message.classList.remove('show');
            }, 3000);
        }
    </script>
{% endblock %}
